class Jalapeno extends GuaAnimation {
    static new(game) {
        let p = new this(game, animationJalapeno)
        p.setup()
        return p
    }

    setup() {
        // row表示在草地的第几排
        this.row = -1
        this.cooldown = 25
        this.score = 125
        this.boom = false
        this.boomtime = 25
        this.hp = 50
        this.range = 755
    }

    remove() {
        this.scene.removeBoom(this)
    }

    changestatus() {
        this.cooldown--
        log('this.cooldown', this.cooldown)
        if (this.cooldown === 0) {
            this.boom = true

        }
        if (this.boom) {
            this.changeAnimation('attack')
            this.boomtime--
            if (this.boomtime === 0) {
                // 爆炸动画播完后删除植物
                this.remove()
            }
        }
    }

    attack() {
        this.hp--
        if (this.hp === 0) {
            this.scene.removeBoom(this)
        }
    }

    update() {
        super.update()
        this.changestatus()
    }
}